package com.sgb.link.entity;

import com.contrarywind.interfaces.IPickerViewData;
import com.google.gson.annotations.SerializedName;
import com.swgk.core.interfaces.PopName;

import java.io.Serializable;
import java.util.Objects;

public class PickFilterEntity<T> implements Serializable, IPickerViewData, PopName {

    private String no;

    @SerializedName(value = "name", alternate = {"simpleName"})
    private String name;

    private int num;//个人中心 数量统计新加

    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }
    private int iconResourceID;

    public int getIconResourceID() {
        return iconResourceID;
    }

    public void setIconResourceID(int iconResourceID) {
        this.iconResourceID = iconResourceID;
    }

    private String iconUrl;

    public String getIconUrl() {
        return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }
    public PickFilterEntity(String no, String name, int num) {
        this.no = no;
        this.name = name;
        this.num = num;
    }

    public PickFilterEntity() {

    }
    public PickFilterEntity(String no, String name) {
        this.no = no;
        this.name = name;
    }

    public PickFilterEntity(String no, String name, T children) {
        this.no = no;
        this.name = name;
        this.children = children;
    }

    private T children;

    //非服务器字段， 用于保存item的状态
    private boolean isChoose;
    private boolean isCheckItem;
    private boolean isClickItem;

    public boolean isClickItem() {
        return isClickItem;
    }

    public void setClickItem(boolean clickItem) {
        isClickItem = clickItem;
    }

    public boolean isCheckItem() {
        return isCheckItem;
    }

    public void setCheckItem(boolean checkItem) {
        isCheckItem = checkItem;
    }

    public boolean isChoose() {
        return isChoose;
    }

    public void setChoose(boolean choose) {
        isChoose = choose;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public T getChildren() {
        return children;
    }

    public void setChildren(T children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "PickFilterEntity{" +
                "no='" + no + '\'' +
                ", name='" + name + '\'' +
                ", children=" + children +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PickFilterEntity<?> that = (PickFilterEntity<?>) o;
        return (Objects.equals(no, that.no) || Objects.equals(id, that.id))&&
                Objects.equals(name, that.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(no, name);
    }

    @Override
    public String getPickerViewText() {
        return name;
    }

    @Override
    public String popName() {
        return name;
    }

    @Override
    public String popNo() {
        return getNo();
    }
}
